﻿using System.Windows.Controls;

namespace AOUtils.Libraries
{
    public class LevelValidationRule : ValidationRule
    {
        public override ValidationResult Validate(object value, System.Globalization.CultureInfo cultureInfo)
        {
            int i = 0;
            
            if (!int.TryParse(value.ToString(), out i))
                return new ValidationResult(false, value + " is not an int");
            
            if (i < 1 || i > 220)
                return new ValidationResult(false, value + " is not between 1 and 220");
            return new ValidationResult(true, "");
        }
    }
}
